package com.ym.manager.yinsheng.util;

import com.ym.utils.DateUtil;
import com.ym.utils.JsonUtil;

import java.util.Map;

/**
 * @Author: dhf
 * @ClassName: RequestData
 * @Date: 2022/8/9 16:27
 * @Description:
 * @Version: 1.0
 */
public class RequestData {
    public String requestId;//请求唯一标识，推荐使用UUID
    public String srcMerchantNo;//发起方商户号 示例值：826392148160023
    public String version="v2.0.0";//接口版本：v2.0.0
    public String charset="UTF-8";//编码格式：UTF-8
    public String serviceNo;//服务编码：walletRegister
    public String signType="RSA";//签名类型：RSA，支持RSA、SM2
    public String bizReqJson;//业务请求参数的集合，JSON格式

    public String reqUrl;
    public String notifyUrl;
    public RequestData(){

    }

    public RequestData(Map<String,Object> requestMap){
        this.requestId = getOrderSN();
        this.bizReqJson = JsonUtil.toJson(requestMap);
    }

    public static String getOrderSN(){
        return String.format("%s%s%s", DateUtil.getYYMMDD(),System.currentTimeMillis()%1000000000,(int)(Math.random()*899999+100000));
    }
}
